function add(){
    let count=0
    return function(){
        count++
    }
}
const res=add()
res()//count=1
res()//count=2

//闭包应用：柯理化函数
function getArea(width){
    return function(height){
        return width*height
    }
}
const area=getArea(10)//固定宽度
console.log(area(20))//200
console.log(area(30))//300



